package wang.Seacher.util;

import java.io.File;

import javax.imageio.stream.FileImageOutputStream;

public class Byte2Image {

	/**
	 * <p> 
	 *字节流转图片
	 *</p>
	 * @author： wangqiang
	 * @日期：2016-7-28 下午2:31:08
	 * @param data
	 * @param path
	 */
	 public static void byte2image(byte[] data,String path){
		    if(data.length<3||path.equals("")) return;
		    try{
		    FileImageOutputStream imageOutput = new FileImageOutputStream(new File(path));
		    imageOutput.write(data, 0, data.length);
		    imageOutput.close();
		    System.out.println("Make Picture success,Please find image in " + path);
		    } catch(Exception ex) {
		      System.out.println("Exception: " + ex);
		      ex.printStackTrace();
		    }
		  }

}
